<?php
namespace App\Models\GoodsType;

use App\Contracts\Repositories\GoodsTypeRepository as GoodsTypeRepositoryContract;

class GoodsTypeRepository implements GoodsTypeRepositoryContract
{
    public function add($record)
    {
        return GoodsType::create($record);
    }

    public function getByConditions($conditions, $withs)
    {
        if (is_array($withs) || is_string($withs) || is_null($withs)) {
            return GoodsType::with($withs)->where($conditions)->get()->toArray();
        } else {
            return array();
        }
    }
}
